package com.yyk.yykywd.mvvm.view_model

import androidx.lifecycle.MutableLiveData
import com.yyk.yykywd.bean.BaseBean
import com.yyk.yykywd.mvvm.entity.MeetingDetailBean
import com.yyk.yykywd.mvvm.model.GetBase
import com.yyk.yykywd.mvvm.model.MeetingModel
import java.util.*

/**
 * 文件描述：
 * Created by guo on 2019-11-20.
 */
class ModifyMeetingInvitationViewModel : BaseViewModel() {
    var type: String = ""
    var id: String = ""
    var meetingModel = MeetingModel()
    var mMeetingDetail = MutableLiveData<MeetingDetailBean>()
    val endDate: Calendar = Calendar.getInstance()

    init {
        endDate.set(2050, 11, 31)
    }

    fun getMeetingDetail() {
        meetingModel.getMeetingDetail(id, object : MeetingModel.GetMeetingDetail {
            override fun getInfo(meetingDetail: MeetingDetailBean) {
                mMeetingDetail.value = meetingDetail
            }

            override fun onError(e: String) {
            }

        })
    }

    fun addOrModifyMeeting(name: String,
                           province_id: String,
                           city_id: String,
                           area_id: String,
                           site: String,
                           start_time: String,
                           remark: String) {
        meetingModel.addOrModifyMeeting(id = id,
                name = name,
                province_id = province_id,
                city_id = city_id,
                area_id = area_id,
                site = site,
                start_time = start_time,
                remark = remark, getBase = object : GetBase {
            override fun getInfo(base: BaseBean) {
                setBaseValue(base)
            }

            override fun onError(e: String) {
            }

        })
    }
}